/*矩阵乘法:
[0 1]   [1 0]   [ 2  1]
[2 3] x [   ] = [ 8  3]
[4 5]   [2 1]   [ 14 5]
运算法则:
2=0x1+1x2;  1=0x0+1x1
8=2x1+3x2;  3=2x0+3x1
14=4x1+5x2; 5=4x0+5x1
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll SIZE=10;
const ll MOD=1e9+7;
class Matrix{
    public:
        ll r,c;
        ll data[SIZE][SIZE];
        Matrix(int _r,int _c){
            r=_r;
            c=_c;
            memset(data,0,sizeof(data));
        }
        Matrix operator*(const Matrix&matrix)const{
            Matrix ans(r,matrix.c);
            for(ll i=0;i<r;i++)
                for(ll j=0;j<matrix.c;j++)
                    for(ll k=0;k<c;k++){
                        ans.data[i][j]+=data[i][k]*matrix.data[k][j];
                        ans.data[i][j]%=MOD;
                    }
            return ans;
        }
        Matrix operator^(ll p)const{
            Matrix ans(r,c);
            Matrix x=*this;
            for(ll i=0;i<r;i++) ans.data[i][i]=1;
            while(p){
                if(p&1) ans=ans*x;
                x=x*x;
                p>>=1;
            }
            return ans;
        }
};
int main(){
    Matrix A(3,3);
    A.data[0][0]=1;A.data[0][1]=0;A.data[0][2]=1;
    A.data[1][0]=1;A.data[1][1]=0;A.data[1][2]=0;
    A.data[2][0]=0;A.data[2][1]=1;A.data[2][2]=0;
    ll n;
    cin>>n;
    if(n<=3){
        cout<<1<<endl;
        return 0;
    }
    Matrix a321(3,1);
    a321.data[0][0]=1;
    a321.data[1][0]=1;
    a321.data[2][0]=1;
    Matrix ans=(A^(n-3))*a321;
    cout<<(ans.data[0][0]+MOD)%MOD<<endl;
    return 0;
}